<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑员工</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/app/admin/component/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" media="all">
</head>
<body>
    <div class="layui-form" lay-filter="layuiadmin-form-staff" style="padding: 20px 30px 0 0;">
        <input type="hidden" name="id" value="{$staff.id}">
        <div class="layui-form-item">
            <label class="layui-form-label">登录账号</label>
            <div class="layui-input-inline">
                <input type="text" name="username" value="{$staff.username}" lay-verify="required" placeholder="请输入登录账号" autocomplete="off" class="layui-input" readonly>
            </div>
            <div class="layui-form-mid layui-word-aux">登录账号不可修改</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">登录密码</label>
            <div class="layui-input-inline">
                <input type="password" name="password" placeholder="不修改请留空" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">不修改请留空</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">确认密码</label>
            <div class="layui-input-inline">
                <input type="password" name="confirm_password" lay-verify="confirmPass" placeholder="请再次输入密码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">员工姓名</label>
            <div class="layui-input-inline">
                <input type="text" name="name" value="{$staff.name}" lay-verify="required" placeholder="请输入员工姓名" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">手机号码</label>
            <div class="layui-input-inline">
                <input type="text" name="phone" value="{$staff.phone}" lay-verify="required|phone" placeholder="请输入手机号码" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">所属门店</label>
            <div class="layui-input-inline">
                <select name="store_id" lay-verify="required">
                    <option value="">请选择所属门店</option>
                    {foreach $stores as $store}
                    <option value="{$store.id}" {if $staff.store_id == $store.id}selected{/if}>{$store.name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">员工角色</label>
            <div class="layui-input-inline">
                <select name="role" lay-verify="required">
                    <option value="">请选择角色</option>
                    <option value="1" {if $staff.role == 1}selected{/if}>管理员</option>
                    <option value="2" {if $staff.role == 2}selected{/if}>店长</option>
                    <option value="3" {if $staff.role == 3}selected{/if}>收银员</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">员工状态</label>
            <div class="layui-input-inline">
                <input type="radio" name="status" value="1" title="启用" {if $staff.status == 1}checked{/if}>
                <input type="radio" name="status" value="0" title="禁用" {if $staff.status == 0}checked{/if}>
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-staff-submit" id="LAY-staff-submit" value="确认">
        </div>
    </div>

    <script src="/app/admin/component/layui/layui.js"></script>
    <script src="/app/admin/component/pear/pear.js"></script>
    <script>
    layui.use(['form'], function(){
        var $ = layui.$
        ,form = layui.form;

        //自定义验证规则
        form.verify({
            confirmPass: function(value){
                if($('input[name=password]').val() !== value)
                    return '两次密码输入不一致！';
            }
        });
    })
    </script>
</body>
</html> 